import request from '@/utils/request';
import type {
  DashboardStats,
  SystemStatus,
  RecentActivity,
  PerformanceMetrics,
  UserBehaviorAnalytics,
  ContentStats
} from '@/types/dashboard';

// 获取仪表盘统计数据
export const getDashboardStats = (): Promise<DashboardStats> => {
  return request.post('/api/admin/dashboard/stats', {});
};

// 获取系统状态
export const getSystemStatus = (): Promise<SystemStatus> => {
  return request.post('/api/admin/dashboard/system-status', {});
};

// 获取最近活动
export const getRecentActivities = (params?: { limit?: number }): Promise<RecentActivity[]> => {
  return request.post('/api/admin/dashboard/recent-activities', params || {});
};

// 获取性能指标
export const getPerformanceMetrics = (params?: {
  timeRange?: '1h' | '24h' | '7d' | '30d'
}): Promise<PerformanceMetrics> => {
  return request.post('/api/admin/dashboard/performance', params || {});
};

// 获取用户行为分析
export const getUserBehaviorAnalytics = (params?: {
  timeRange?: '1d' | '7d' | '30d'
}): Promise<UserBehaviorAnalytics> => {
  return request.post('/api/admin/dashboard/user-behavior', params || {});
};

// 获取内容统计
export const getContentStats = (): Promise<ContentStats> => {
  return request.post('/api/admin/dashboard/content-stats', {});
};
